/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package log2excel.ExcelManager;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import jxl.*;
import jxl.read.biff.BiffException;

/**
 *
 * @author aegish
 */
public class OpenExcel {
    private String filename;
    private Workbook workbook;
    
    public OpenExcel(String filename) {
        this.filename = filename;
        try {
            workbook = Workbook.getWorkbook(new File(filename));
        } catch (IOException ex) {
            Logger.getLogger(OpenExcel.class.getName()).log(Level.SEVERE, null, ex);
        } catch (BiffException ex) {
            Logger.getLogger(OpenExcel.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    public Sheet[] getSheets(){
        return workbook.getSheets();
    }
    public Sheet getSheet(int s){
        return workbook.getSheet(s);
    }
    public Sheet getSheet(String s){
        return workbook.getSheet(s);
    }
    public void close(){
        workbook.close();
    }
    public CreateExcel openWritableWorkbook(){
        close();
        return new CreateExcel(filename);
    }
}
